package com.mayikt;

/**
 * @ClassName Test005
 * @Author 蚂蚁课堂余胜军 QQ644064779 www.mayikt.com
 * @Version V1.0
 **/
public class Test005 extends Thread {
    private Object lockObject = new Object();

    @Override
    public void run() {
        a();
    }

    public void a() {
        //  虚拟机里面
        synchronized (lockObject) {
            System.out.println("我是A调用B");
            // 当前线程变为阻塞状态同时 释放锁

            lockObject.notify();
            b();
        }
    }

    private void b() {
        synchronized (lockObject) {
            System.out.println("我是B");
        }
    }

    public static void main(String[] args) {

    }


}
